const mysql = require('mysql')

const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: '3051532wyp.',
  database: '1708Btest'
})

const exec = (sql) => {
  return new Promise((resolve, reject) => {
    pool.query('select * from  users', (err, data, fields) => {
      if (err) reject(err)
      console.log(fields, 'fields')
      resolve(data)
    })
  })
}

module.exports = { exec }

